package com.mjk.manager.magicapi.core.core.handler;


import com.mjk.manager.magicapi.core.core.annotation.Message;
import com.mjk.manager.magicapi.core.core.config.Constants;
import com.mjk.manager.magicapi.core.core.config.MessageType;
import com.mjk.manager.magicapi.core.core.config.WebSocketSessionManager;
import com.mjk.manager.magicapi.core.core.context.MagicConsoleSession;

public class MagicCoordinationHandler {

    @Message(MessageType.SET_FILE_ID)
    public void setFileId(MagicConsoleSession session, String fileId) {
        session.setAttribute(Constants.WEBSOCKET_ATTRIBUTE_FILE_ID, fileId);
        WebSocketSessionManager.sendToOther(session.getClientId(), MessageType.INTO_FILE_ID, session.getAttribute(Constants.WEBSOCKET_ATTRIBUTE_CLIENT_ID), fileId);
    }
}
